package com.demo.thread.sync;

import lombok.Data;

/**
 * @author : YU.TAN
 * @date : 2021/11/3 18:09
 */
@Data
public class SyncNum {

    private Integer number=100;
    private Boolean flag=false;

    //每次被击打后血量减5
    public int decreaseBlood() {
        number = number - 5;
        return number;
    }

    //通过血量判断主宰是否还存活
    public boolean isAlive() {
        flag=number > 0;
        return number > 0;
    }
}
